package development;

import java.util.Hashtable;

import state.GameForm;
import state.Key;
import state.component.TextField;
import state.util.Color;

public class FrmTestTouchTextField extends GameForm {
  private TextField textField;
  
  private static GameForm singleton;
  
  public static GameForm instance() {
    if (singleton == null) {
      singleton = new FrmTestTouchTextField();
    }
    return singleton;
  }

  public void init(Hashtable parameters) {
    manager.setBackGroundColor(Color.BLACK_CODE);
    textField = (TextField) new TextField(manager, TextField.CONSTRAINT_ANY, Global.TEXT_FIELD_STYLE).setFocused(true).setPosition(50, 50).setSize(150, 20);
  }
  
  public void keyReleased(int keyCode) {
    textField.keyReleased(keyCode);
    
    if (keyCode == Key.SOFT_RIGHT) {
      Global.nextState(FrmMenu.instance(), null);
    }
  }

  protected void destroy() {
  }

}
